{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/kth-largest-element-in-a-stream\n",
    "\n",
    "\n",
    "\n",
    "Time Limit Exceeded\n",
    "\n",
    "\n",
    "\n",
    "```go\n",
    "package main\n",
    "\n",
    "import \"sort\"\n",
    "\n",
    "type KthLargest struct {\n",
    "\tstream []int\n",
    "\tk      int\n",
    "}\n",
    "\n",
    "func Constructor(k int, nums []int) KthLargest {\n",
    "    stream := make([]int, 0)\n",
    "    for _, num := range nums {\n",
    "        stream = append(stream, num)\n",
    "    }\n",
    "\n",
    "\treturn KthLargest{\n",
    "        stream,\n",
    "\t\tk,\n",
    "\t}\n",
    "}\n",
    "\n",
    "func (this *KthLargest) Add(val int) int {\n",
    "\tthis.stream = append(this.stream, val)\n",
    "\tsort.Ints(this.stream)\n",
    "\treturn this.stream[len(this.stream)-this.k]\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go",
   "language": "go",
   "name": "gophernotes"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.15.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
